import request from '@/utils/request'

// 查询用户个人信息
export function getSelfInfo() {
	return request({
		url: '/company/self',
		method: 'get'
	})
}

// 获取行政区划树形结构
export function deptTree(deptId) {
	return request({
		url: '/system/user/v2/deptTree',
		method: 'get',
		params: {
			deptId: deptId
		}
	})
}

// 获取行政区划树形结构
export function getDeptTree(deptId) {
	return new Promise((resolve, reject) => {
		deptTree(deptId).then(response => {
			resolve(response.data);
		}).catch(err => reject(err));
	})
}

// 根据键名查询参数
export function configKey(key) {
	return new Promise((resolve, reject) => {
		request({
			url: '/system/config/configKey/' + key,
			method: 'get'
		}).then(res => {
			resolve(res.msg);
		})
	})
}